POV-Ray : Newsgroups : povray.newusers : Declare : Re: Declare Server Time
6 Sep 2024 14:14:34 EDT (-0400)
  Re: Declare  
From: Jerry Anning
Date: 9 Feb 1998 15:56:43
Message: <34DF6D81.F1C93DD3@dhol.com>
Mark Wright wrote:

> Ok ... Am I on the right track with this? The problem I seem to be
> having now is when I rotate this cross, it's not as one object
> and doesn't rotate as one. Man .. I was up way too late trying to
> figure all this out.

The problem is that POV thought that "redcross" referred only to the
first box, and that you were simply telling it to render the second
box.  This is tricky, but watch:  for *objects*, POV reads the material
after the equal sign until the parser has finished a complete object
definition.  This also applies to lights, cameras and most other things,
including colors.  When POV finished reading the first box, that
completed an object definition, so the second box was not added to
"redcross".  FOR *textures*, POV keeps reading until it finds something
that is NOT a texture.  If it finds several successive textures, it
assumes you are creating a layered texture, and the #declare'd name
applies to the whole set of textures.  If you want to combine several
objects under a #declare'd name, you need to put the objects into a
union *in the definition*.  If some or all of the objects are
transparent, use "merge" instead of "union".  Your code should read as
follows:

//begin POV code

#declare redcross =
union
    {
        box { < -0.5, -0.5, -0.5>, < 0.5, 0.5, 0.5>
              texture { pigment { color Red } }
              scale  < 5, 14, -3 >
              translate  < 0, -4, 1 > }

        box { < -0.5, -0.5, -0.5>, < 0.5, 0.5, 0.5>
              texture { pigment { color Red } }
              scale  < 14, 5, -3 >
              translate  < 0, -4, 1 > }
    }

 object { redcross  rotate y*(360*clock)}

// End POV code

Good luck.

Jerry Anning
cle### [at] dholcom


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.